package com.format.Utils;

/**
 * 用于进制转换
 */
public class ScaleTran {
    /**
     *
     * @param s 十六进制字符串
     * @return 转换byte数组
     */
    public static byte[] hex(String s) {
        int len = s.length();
        byte[] data = new byte[len / 2];
        for (int i = 0; i < len; i += 2) {
            data[i / 2] = (byte) ((Character.digit(s.charAt(i), 16) << 4)
                    + Character.digit(s.charAt(i+1), 16));
        }
        return data;
    }
}
